﻿<classes:MSHPhoneApplicationPage 
    x:Class="WP7Client.UserInterface.Pages.ChatPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WP7"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:classes="clr-namespace:WP7Client.Classes"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    Loaded="MSHPhoneApplicationPage_Loaded">
    <classes:MSHPhoneApplicationPage.Resources>
        <classes:DirectionToMarginConverter x:Key="DirectionToMarginConverter"/>
        <classes:DirectionToHorizontalAlignmentConverter x:Key="DirectionToHorizontalAlignmentConverter"/>
    </classes:MSHPhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="Transparent">

        <controls:Pivot Title="MY SOCIAL HUB">
            <controls:PivotItem Header="Chat">
                <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                    <ListBox Name="ListBoxMessages" VerticalAlignment="Stretch" Margin="0,0,0,70" ItemsSource="{Binding Path=Messages, Mode=TwoWay}" HorizontalContentAlignment="Stretch">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Width="420">
                                    <Border Background="{StaticResource PhoneAccentBrush}" Margin="{Binding Path=Incoming, Converter={StaticResource DirectionToMarginConverter}}" HorizontalAlignment="{Binding Path=Incoming, Converter={StaticResource DirectionToHorizontalAlignmentConverter}}" Padding="5,5,5,5">
                                        <StackPanel>
                                            <TextBlock Text="{Binding Message}" TextWrapping="Wrap"/>
                                            <TextBlock Text="{Binding ChatFriendlyTimestamp}" Foreground="Silver"/>
                                        </StackPanel>
                                    </Border>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <TextBox Name="TextBoxMessage" VerticalAlignment="Bottom" AcceptsReturn="True" TextWrapping="Wrap"/>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>

    </Grid>


    <classes:MSHPhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="Resources/Images/Icons/mess.png" Text="Send" Click="ApplicationBarIconButton_Click"/>
        </shell:ApplicationBar>
    </classes:MSHPhoneApplicationPage.ApplicationBar>

</classes:MSHPhoneApplicationPage>
